// 全局混入的属性与方法
const modelUtil = require("../../utils/model")
const routerModule = require('../router/index');
const httpModule = require('../http/index');
const fileModule = require("../http/file");
const layerModule = require('../layer/index');
const computedModule = require("../computed/index")
const globalConfig = require('../../config');

const mixinConfig = {
	 // 是否开启页面全局混入
	openGlobalMixin_page: true
	// 是否开启组件全局混入
	,openGlobalMixin_component: true
	// 是否开启页面计算属性全局混入
	,openGlobalComputed_page: true
	// 是否开启组件计算属性全局混入
	,openGlobalComputed_component: true
	// 页面混入属性与方法
	,globalMixins_page:{
		data: {
			$static: globalConfig.staticPath
		}
		, ...routerModule
		, ...httpModule
		, ...fileModule
		, ...layerModule
		, $model: modelUtil
		, onLoad() {
			if( mixinConfig.openGlobalComputed_page ){
			  computedModule.call(this);
			}
		  }
			
	}
	// 组件混入属性与方法
	,globalMixins_component:{
		data: {
			$static: globalConfig.staticPath
		}
		,methods: {
			...routerModule
			, ...httpModule
			, ...fileModule
			, ...layerModule
			, $model: modelUtil
		}
		, attached() {
			if( mixinConfig.openGlobalComputed_component ){
				computedModule.call(this, false);
			}
		}
	}
 }

 module.exports = mixinConfig;